<#include "./common/_header.htm">
<div class="login-wrapper">
	<div class="login-box">
		<span class="logo-on"></span>
		<div class="login-box-body">
			<p class="login-box-msg">运营管理平台</p>
			<form action="${ctx}/login" method="post">
				<div class="form-group has-feedback">
					<input type="text" name="loginname" id="loginname"
						class="form-control" placeholder="请输入帐号" required> 
						<span class="glyphicon glyphicon-envelope form-control-feedback username"></span>
				</div>
				<div class="form-group has-feedback">
					<input type="password" name="password" id="password"
						class="form-control" placeholder="请输入密码" required> 
						<span class="glyphicon glyphicon-lock form-control-feedback password"></span>
				</div>
				<div class="row">
					<#if RequestParameters['error']??>
					<div class="alert alert-danger alert-dismissible" role="alert">
						登录失败，请联系管理员!</div>
					<#elseif RequestParameters['disabled']??>
					<div class="alert alert-danger alert-dismissible" role="alert">
						此用户已被禁用，请联系管理员!</div>
					<#elseif RequestParameters['badcredentials']??>
					<div class="alert alert-danger alert-dismissible" role="alert">
						用户名或者密码不正确，请重新输入!</div>
					</#if>
				</div>
				<div class="row">
					<!-- <div class="col-xs-8">
						<div class="checkbox icheck">
							<label> <input type="checkbox" id="remember">
								记住密码
							</label>
						</div>
					</div> -->
					<div class="col-xs-12">
						<button type="submit"
							class="btn btn-primary btn-block btn-flat btn-login">登录</button>

					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="copyright">Copyright &copy; 2017   ${companyFullName} All Rights Reserved</div>
</div>
</body>
<script type="text/javascript" src="${ctx}/cus/base.js"></script>
</html>
<script>
	$(function() {
		$('input').iCheck({
			checkboxClass : 'icheckbox_square-blue',
			radioClass : 'iradio_square-blue',
			increaseArea : '20%' // optional
		});
		$("body").addClass("login-page");
		$("body").removeClass("skin-blue");

		$("form").validate({
			submitHandler : function(form) {
				if ($("input[type=checkbox]").is(":checked")) {
					base.cookie.set("loginname", $("#loginname").val());
					base.cookie.set("password", $("#password").val());
					base.cookie.set("remember", true);
				} else {
					base.cookie.set("loginname", null);
					base.cookie.set("password", null);
					base.cookie.set("remember", false);
				}
				$.LoadingOverlay("show");
				$("form").submit();
			}
		});

		(function() {
			var checked = base.cookie.get("remember");
			if (checked == "true") {
				var loginname = base.cookie.get("loginname");
				var password = base.cookie.get("password");
				if (loginname && password) {
					$("#loginname").val(loginname);
					$("#password").val(password);
					$("input").iCheck("check");
				}
			} else {
				$("input").iCheck("uncheck");
			}
		})();

		$(".login-wrapper").height($(window).height());
	})
</script>